package com.flying.inherit.inheritanceTest2;


/**
 * @ClassName: InheritanceTest2
 * @createDate: 2023/6/27 16:42
 * @author: liu
 * @description:继承练习2
 */
public class Test2 {
    public static void main(String[] args) {
        Father father1=new Father();
        Son son =new Son();

        System.out.println(father1.getInfo());   //  atguigu
        System.out.println(son.getInfo());      //  atguigu

        son.test();    //  atguigu  atguigu
        son.setInfo("尚硅谷");
        son.test();    //  尚硅谷  尚硅谷

    }

}

class Father {
    private  String info="atguigu";
    public void setInfo(String info){
        this.info=info;
    }

    public String getInfo(){
        return info;
    }
}

class Son extends Father {
    private String info="大硅谷";

    public void test(){
        System.out.println(this.getInfo());
        System.out.println(super.getInfo());
    }
}